
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>新增IMEI</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <link href="/CarHistory/css/addimei.css" rel="stylesheet" type="text/css" />
    
</head>
<body>    
     
    <form id="form1" method="post">
        
        <fieldset style="border:solid 1px #aaa;padding:3px;">
            <legend >新增设备信息</legend>
            <div style="padding:5px;">
        <table>
            
            <tr>
                <td >设备号（IMEI）：</td>
                <td colspan="3">    
                    <input name="remarks" class="mini-textarea" style="width:350px;" emptyText="请输入设备号，可同时输入多个，以逗号隔开，如（xxx,xxx）" />
                </td>
            </tr>          
        </table>            
            </div>
        </fieldset>
        <div style="text-align:center;padding:10px;">               
            <a class="mini-button" onclick="onOk" style="width:60px;margin-right:20px;">确定</a>       
            <a class="mini-button" onclick="onCancel" style="width:60px;">取消</a>       
        </div>        
    </form>
    <script src="/CarHistory/miniui/boot.js" type="text/javascript"></script>
    <script type="text/javascript">
        mini.parse();

        var form = new mini.Form("form1");

        function SaveData() {
            var o = form.getData();            
			
            form.validate();
            if (form.isValid() == false) return;

            var json = mini.encode([o]);
      
            $.ajax({
                url: "/CarHistory/GpsData/addImei",
				type: 'post',
                data: { data: json },
                cache: false,
                success: function (text) {
                    CloseWindow("save");
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(jqXHR.responseText);
                    CloseWindow();
                }
            });
        }

        
        function GetData() {
            var o = form.getData();
            return o;
        }
        function CloseWindow(action) {            
            if (action == "close" && form.isChanged()) {
                if (confirm("数据被修改了，是否先保存？")) {
                    return false;
                }
            }
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();            
        }
        function onOk(e) {
            SaveData();
        }
        function onCancel(e) {
            CloseWindow("cancel");
        }

    </script>
</body>
</html>
